<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Tag extends Model
{
    use HasFactory;
	
	protected $primaryKey = 'tag_id';
	
	protected $casts = [
        'created_at'   => 'datetime:Y-m-d H:i:s',
        'updated_at'   => 'datetime:Y-m-d H:i:s',
    ];
	
	/*public function arts()
    {
		// 第一个参数是关联模型类名，第二个参数是中间表名，第三个参数是当前模型在中间表中的外键名，第四个参数是关联模型在中间表中的外键名
        return $this->belongsToMany(Art::class,'tags','tag_id','art_id')->where('tags.tagname','like',"%笛卡尔积%");
    }
	public function arts()
    {
        return $this->belongsTo(Art::class, 'art_id');
    }*/
	
}
